import {
    download,
    getTypes,
} from "./api/search.js"


Vue.use(Vuex)
const state = {

};

const mutations = {

};

const actions = {
    getTypes({
        commit
    }, formData) {
        return new Promise((resolve, reject) => {
            getTypes(formData.resource_url).then(response => {
                resolve(response)
            }).catch(error => {
                reject(error)
            })
        })
    },
    download({
        commit
    }, id) {
        return new Promise((resolve, reject) => {
            download(id).then(response => {
                resolve(response)
            }).catch(error => {
                reject(error)
            })
        })
    },

};
export default new Vuex.Store({
    state,
    mutations,
    actions,
})